package com.tiance.demo.service.mysql.bo.pageindex;

import com.tiance.demo.service.mysql.bo.Page;

/**
 * 索引的页信息, 不包含file header和file tailer
 */
public class PageIndex extends Page {

    public PageIndex(byte[] bytes) {
        super(bytes);
    }

    private IndexPageHeader indexPageHeader;

    private Infimum infimum;

    private Supremum supremum;

    private UserRecord userRecord;

    private FreeSpace freeSpace;

    private PageDirectory pageDirectory;


    public IndexPageHeader getIndexPageHeader() {
        return indexPageHeader;
    }

    public void setIndexPageHeader(IndexPageHeader indexPageHeader) {
        this.indexPageHeader = indexPageHeader;
    }

    public Infimum getInfimum() {
        return infimum;
    }

    public void setInfimum(Infimum infimum) {
        this.infimum = infimum;
    }

    public Supremum getSupremum() {
        return supremum;
    }

    public void setSupremum(Supremum supremum) {
        this.supremum = supremum;
    }

    public UserRecord getUserRecord() {
        return userRecord;
    }

    public void setUserRecord(UserRecord userRecord) {
        this.userRecord = userRecord;
    }

    public FreeSpace getFreeSpace() {
        return freeSpace;
    }

    public void setFreeSpace(FreeSpace freeSpace) {
        this.freeSpace = freeSpace;
    }

    public PageDirectory getPageDirectory() {
        return pageDirectory;
    }

    public void setPageDirectory(PageDirectory pageDirectory) {
        this.pageDirectory = pageDirectory;
    }

    @Override
    public String toString() {
        return "PageIndex:\n============\n" +
                fileHeader +
                "\n" + indexPageHeader +
                "\n\n" + infimum +
                "\n\n" + supremum +
                "\n\n" + userRecord +
                "\n\nfreeSpace:\n" + freeSpace +
                "\n\npageDirectory:\n" + pageDirectory +
                "\n\n" + fileTailer;
    }
}
